package com.dapeng.cleardatabackend.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dapeng.cleardatabackend.model.dto.relation.RelationAddRequest;
import com.dapeng.cleardatabackend.model.dto.relation.RelationDeleteRequest;
import com.dapeng.cleardatabackend.model.dto.relation.RelationGetRequest;
import com.dapeng.cleardatabackend.model.dto.relation.RelationUpdateRequest;
import com.dapeng.cleardatabackend.model.entity.Relation;
import com.dapeng.cleardatabackend.model.vo.RelationVO;
import org.springframework.http.ResponseEntity;

import java.util.List;

/**
* @author dapeng
* @description 针对表【relation(关系表)】的数据库操作Service
* @createDate 2024-12-22 13:29:10
*/
public interface RelationService extends IService<Relation> {

    /**
     * 批量保存所有内容
     *
     * @param relationList 关系列表
     * @param graphId      图形id
     */
    void saveRelationToNeo4j(List<Relation> relationList, Long graphId);

    /**
     * 按图id硬删除
     *
     * @param graphId 图形id
     */
    void hardRemoveByGraphId(Long graphId);

    /**
     * 获取关系页面
     *
     * @param relationGetRequest 获取关系请求
     * @return {@link Page }<{@link RelationVO }>
     */
    Page<RelationVO> getRelationPage(RelationGetRequest relationGetRequest);

    /**
     * 获取原始关系页面
     *
     * @param relationGetRequest 获取关系请求
     * @return {@link Page }<{@link RelationVO }>
     */
    Page<RelationVO> getOriginalRelationPage(RelationGetRequest relationGetRequest);

    /**
     * 更新关系
     *
     * @param relationUpdateRequest 关系更新请求
     * @return {@link Boolean }
     */
    Boolean updateRelation(RelationUpdateRequest relationUpdateRequest);

    /**
     * 删除关系
     *
     * @param relationDeleteRequest 关系删除请求
     * @return {@link Boolean }
     */
    Boolean deleteRelation(RelationDeleteRequest relationDeleteRequest);


    /**
     * 添加单个关系
     *
     * @param relationAddRequest 关系添加请求
     * @return {@link Boolean }
     */
    Long addSingleRelation(RelationAddRequest relationAddRequest);


    /**
     * 删除关系
     *
     * @param graphId 图id
     * @return {@link Boolean }
     */
    Boolean deleteRelationByGraphId(Long graphId);

    /**
     * 下载csv
     *
     * @param id 图谱id
     * @return {@link ResponseEntity }<{@link byte[] }>
     */
    ResponseEntity<byte[]> downloadCsv(Long id);

    /**
     * 下载原始csv
     *
     * @param id id
     */
    ResponseEntity<byte[]> downloadOriginalCsv(Long id);
}
